﻿using System.Collections.Generic;

namespace Maltose.Data
{
    /// <summary>
    /// 正常分页参数
    /// </summary>
    public class SqlPageNormal : ISqlNormalPage
    {

        /// <summary>
        /// 表名
        /// </summary>
        public string TableName { get; set; }

        /// <summary>
        /// 利用某字段进行分页
        /// <para>默认id</para>
        /// </summary>
        public string KeyFiled { get; set; } = "id";

        /// <summary>
        /// 需要显示的字段
        /// <para>默认全部</para>
        /// </summary>
        public string ShowField { get; set; } = "*";

        /// <summary>
        /// 排序字段 省略 order
        /// </summary>
        public string OrderBy { get; set; } = "";

        /// <summary>
        /// 条件 where 省略
        /// </summary>
        public SqlPageString Where { get; set; } = new SqlPageString().True();

        /// <summary>
        /// 分页当前页 默认=1
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 分页大小 默认=10
        /// </summary>
        public int PageSize { get; set; } = 10;

    }


    /// <summary>
    /// 正常分页参数 不带统计
    /// </summary>
    public class SqlPageNormalNoneCount : SqlPageNormal
    {

    }

    /// <summary>
    /// 正常分页带统计字段
    /// </summary>
    public class SqlPageNormalSum : SqlPageNormal
    {
        /// <summary>
        /// 需要统计的字段
        /// </summary>
        public List<string> FieldSum { get; set; }
    }
}
